package com.telecom.cms.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.telecom.cms.util.Constant;
import com.telecom.cms.dto.*;
import com.telecom.cms.util.CurrentTime;

public class SEG_USER_SQL_LOGDAO {

	private static final String insert = "insert into "
			+ Constant.SEG_USER_SQL_LOG + "  values (?,?,?,?,?)";

	private Connection conn = null;

	public SEG_USER_SQL_LOGDAO(Connection con) {

		this.conn = con;

	}

	public void insert(String userid, String latnid, String purpose, String sql) {
		PreparedStatement ps = null;
	//	System.out.print(purpose);
		try {
			ps = conn.prepareStatement(insert);
			ps.setString(1, userid);
			ps.setString(2, latnid);
			ps.setString(3, purpose);
			ps.setString(4, sql);
			ps.setString(5, CurrentTime.getCurrentTime());
			
			ps.execute();

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (ps != null) {
					ps.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
